<?php
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

$eventTable = new BAEventSheet();

$eventView = $eventTable->getView();
?>
<table class="table table-hover">
    <thead>
        <tr>
            <th><input type="checkbox" name="checkAll_2" id="checkAll_2"></th>
            <th>活动名称</th>
            <th>活动类型</th>
            <th>活动描述</th>
            <th>操作</th>
        </tr> 
    </thead>
    <tbody>
        <?php foreach ($eventView as $eventId => $event) { ?>
            <tr>
                <td><label class="checkbox">
                        <input type="checkbox" name="subBox[]" value="<?php echo $event->id; ?>"> 
                    </label></td>
                <td> <?php echo $event->getItem('name')->getValue(); ?> </td>
                <td> <?php
                    $eventTypeId = $event->getItem('eventTypeId')->getValue();
                    $eventType = new BACategory($eventTypeId);
                    echo $eventType->name;
                    ?> 
                </td>
                <td> <?php echo $event->getItem('description')->getValue(); ?> </td>
                <td>
                    <div class="row-fluid">
                        <?php
                        echo $control->getAjaxLink(array('name' => '修改', 'id' => 'modifyEvent'), array('eventId' => $eventId));
                        $adminViewItem = $event->getItem('adminView');
                        echo " | ";
                         echo $control->getAjaxLink(array('name' => '删除', 'id' => 'deleteEvent'), array('eventId' => $eventId));
                        if ($adminViewItem) {
                            echo " | ";
                            echo $control->getAjaxLink(array('name' => '设置', 'id' => 'adminEvent'), array('eventId' => $eventId));
                        }
                        ?>
                    </div>                   
                </td>
            </tr>
        <?php } ?>
    </tbody>
</table>
<?php
echo $control->getAjaxLink(array('name' => '添加活动', 'id' => 'showAddEvent'), array(
    'eventId' => 0,
    'htmlOptions' => array('class' => 'btn')
));
?>
